// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Vuex from 'vuex'

import store from './store'
import iView from 'iview';
import Whttp from '@/libs/http'
import Core from '@/libs/common'
import Wcomponents from '@/libs/components'



import 'iview/dist/styles/iview.css';
import 'font-awesome/css/font-awesome.min.css';
//import '../mytheme/index.less';
import '../my-theme/dist/iview.css';

import App from './App'
import router from './router'


Vue.use(Vuex)
Vue.use(iView);
Vue.use(Wcomponents)
window.Whttp = Whttp;

Vue.config.productionTip = false


Vue.prototype._getData = function(cdata){
	
	if(Array.isArray(cdata)){
		var data = [];

		for(var i=0,len=cdata.length;i<len;i++){
			
			if(typeof(cdata[i])=='object'){
				var ls_arr = this._getData(cdata[i]);
				
			}
			else{
				var ls_arr = cdata[i];
			}
			
			data.push(ls_arr);
		}
	}
	else{
		var data = {};
		for(var i in cdata){
			if(typeof(cdata[i])=='object'){
				data[i] = this._getData(cdata[i]);
			}
			else{
				data[i] = cdata[i];
			}
		}
	}
	return data;
}


Vue.prototype._checkPriv = function(priv_name,privs){
	
	if(priv_name=='no_priv'){
		return true;
	}
	
	if(!Array.isArray(privs)){
		return false;
	}
	
	if(privs.in_array('All')){
		return true;
	}
	
	
	var fg = priv_name.split('|');
	
	for(var i=0;i<fg.length;i++){
		if(fg[i]==''){
			continue;
		}
		if(privs.in_array(fg[i])){
			return true;
		}
	}
	return false;
}

/* eslint-disable no-new */
var arr = new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})